//
//  NKMoiveInfoController.m
//  NiKi
//
//  Created by qiang chen on 16/6/27.
//  Copyright © 2016年 qiang chen. All rights reserved.
//

#import "NKMoiveInfoController.h"
#import "NKMoiveInfoCell.h"
#import "NKShareController.h"

@interface NKMoiveInfoController ()<UITableViewDelegate,UITableViewDataSource,NKMoiveInfoCellDelegate>{
    
    __weak IBOutlet UITableView *_tableV;
    __weak IBOutlet UIImageView *_headBgImageV;
    IBOutlet UIView *_headV;
    IBOutlet UIView *_sectionV;
    
    
    IBOutlet UIView *_moreV;
    __weak IBOutlet UILabel *_infoL;
    __weak IBOutlet UIButton *_downLoadBtn;
    __weak IBOutlet UIButton *_collectionBtn;
    __weak IBOutlet UIButton *_shareBtn;
    __weak IBOutlet UIButton *_zanBtn;
}

@end

@implementation NKMoiveInfoController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.layer.contents = (id)[UIImage imageNamed:@"背景底图"].CGImage;
    [_tableV registerNib:[UINib nibWithNibName:NSStringFromClass([NKMoiveInfoCell class]) bundle:nil] forCellReuseIdentifier:moiveInfoCell];
    _tableV.tableHeaderView = _headV;    
    
    _moreV.frame = CGRectMake(0, 0, ScreenW, ScreenH);
    
}

- (IBAction)_playBtnClick:(UIButton *)sender {
}

- (IBAction)collectionBtnClick:(UIButton *)sender {
}

- (IBAction)downloadAllBtnClick:(UIButton *)sender {
}

#pragma mark - NKMoiveInfoCellDelegate
- (void)moiveInfoCell:(NKMoiveInfoCell *)cell moreBtnClick:(UIButton *)button {
    [[UIApplication sharedApplication].keyWindow addSubview:_moreV];
}

#pragma mark - More
- (IBAction)moreBtnClick:(UIButton *)sender {
    [_moreV removeFromSuperview];
    if (sender == _shareBtn) {
        [self presentViewController:[NKShareController new] animated:YES completion:nil];
    }
}

- (IBAction)cancleMoreBtnClick:(UIButton *)sender {
    [_moreV removeFromSuperview];
}

#pragma mark - tableVDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 8;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NKMoiveInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:moiveInfoCell];
    cell.delegate = self;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 75;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 55;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return _sectionV;
}
@end
